Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
14 lines (11 loc) · 466 Bytes

15.7 - 在php-fpm或apache中使用swoole.md

File metadata and controls

14 lines (11 loc) · 466 Bytes

在php-fpm或apache中使用swoole

swoole中绝大部分的模块只能用于CLI命令行环境,只有同步阻塞的swoole_client可以用于php-fpmapache环境。

同步swoole_client

$client = new swoole_client(SWOOLE_SOCK_TCP); //同步阻塞
$client->connect('127.0.0.1', 9501) or die("connect failed\n");

$client->send(str_repeat("A", 600));
$data = $client->recv(700, 0) or die("recv failed\n");
echo "recv: " . $data . "\n";